#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>

using namespace std;

int readInt(){
	int x = 0, flg = 0;
	char ch = getchar();
	while(ch < '0' || ch > '9'){
		if(ch == '-')	flg = 1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
		x = x * 10 + (ch ^ '0');
		ch = getchar();
	}
	if(flg)
		x = - x;
	return x;
}

int N, A, B;
struct Airline{
	int s, t, id;
}X[100010], Y[100010];
int ans[2][100010];
priority_queue<int, vector<int>, greater<int> > PQ;
struct Event{
	int typ, id, tim;
	Event(int typ=0, int id=0, int tim=0)
		:typ(typ), id(id), tim(tim){}
	bool operator < (const Event& x)const{
		return tim < x.tim;
	}
};
vector<Event> V;
inline void calcAns(int len, Airline* s, int* cnt){
	V.clear();
	while(!PQ.empty())
		PQ.pop();
	for(int i=1; i<=len; i++){
		s[i].s = readInt();
		s[i].t = readInt();
		s[i].id = 0;
		V.push_back(Event(1, i, s[i].s));
		V.push_back(Event(0, i, s[i].t));
		PQ.push(i);
	}
	sort(V.begin(), V.end());
	Event tmp;
	for(int i=0; i<(int)V.size(); i++){
		tmp = V[i];
		if(tmp.typ == 1){
			int q = PQ.top(); PQ.pop();
			++ cnt[q]; s[tmp.id].id = q;
		}
		else
			PQ.push(s[tmp.id].id);
	}
	for(int i=1; i<=N; i++)
		cnt[i] += cnt[i-1];
}
int main(){
	freopen("airport.in", "r", stdin);
	freopen("airport.out", "w", stdout);
	N = readInt();
	A = readInt();
	B = readInt();
	calcAns(A, X, ans[0]);
	calcAns(B, Y, ans[1]);
	int anss = 0;
	for(int i=0; i<=N; i++)
		anss = max(anss, ans[0][i] + ans[1][N-i]);
	printf("%d", anss);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
